//
// UInstanceMaterial.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;

public class UInstanceMaterial {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public UInstanceMaterial(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(UInstanceMaterial obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_UInstanceMaterial(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public boolean isLighted() {
    return nel3dJNI.UInstanceMaterial_isLighted(swigCPtr, this);
  }

  public void setLighting(boolean active, CRGBA emissive, CRGBA ambient, CRGBA diffuse, CRGBA specular, float shininess) {
    nel3dJNI.UInstanceMaterial_setLighting__SWIG_0(swigCPtr, this, active, CRGBA.getCPtr(emissive), emissive, CRGBA.getCPtr(ambient), ambient, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, shininess);
  }

  public void setLighting(boolean active, CRGBA emissive, CRGBA ambient, CRGBA diffuse, CRGBA specular) {
    nel3dJNI.UInstanceMaterial_setLighting__SWIG_1(swigCPtr, this, active, CRGBA.getCPtr(emissive), emissive, CRGBA.getCPtr(ambient), ambient, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular);
  }

  public void setLighting(boolean active, CRGBA emissive, CRGBA ambient, CRGBA diffuse) {
    nel3dJNI.UInstanceMaterial_setLighting__SWIG_2(swigCPtr, this, active, CRGBA.getCPtr(emissive), emissive, CRGBA.getCPtr(ambient), ambient, CRGBA.getCPtr(diffuse), diffuse);
  }

  public void setLighting(boolean active, CRGBA emissive, CRGBA ambient) {
    nel3dJNI.UInstanceMaterial_setLighting__SWIG_3(swigCPtr, this, active, CRGBA.getCPtr(emissive), emissive, CRGBA.getCPtr(ambient), ambient);
  }

  public void setLighting(boolean active, CRGBA emissive) {
    nel3dJNI.UInstanceMaterial_setLighting__SWIG_4(swigCPtr, this, active, CRGBA.getCPtr(emissive), emissive);
  }

  public void setLighting(boolean active) {
    nel3dJNI.UInstanceMaterial_setLighting__SWIG_5(swigCPtr, this, active);
  }

  public boolean isUserColor() {
    return nel3dJNI.UInstanceMaterial_isUserColor(swigCPtr, this);
  }

  public void setBlend(boolean active) {
    nel3dJNI.UInstanceMaterial_setBlend(swigCPtr, this, active);
  }

  public void setBlendFunc(UInstanceMaterial.TBlend src, UInstanceMaterial.TBlend dst) {
    nel3dJNI.UInstanceMaterial_setBlendFunc(swigCPtr, this, src.swigValue(), dst.swigValue());
  }

  public void setSrcBlend(UInstanceMaterial.TBlend val) {
    nel3dJNI.UInstanceMaterial_setSrcBlend(swigCPtr, this, val.swigValue());
  }

  public void setDstBlend(UInstanceMaterial.TBlend val) {
    nel3dJNI.UInstanceMaterial_setDstBlend(swigCPtr, this, val.swigValue());
  }

  public void setAlphaTestThreshold(float at) {
    nel3dJNI.UInstanceMaterial_setAlphaTestThreshold(swigCPtr, this, at);
  }

  public void setZWrite(boolean active) {
    nel3dJNI.UInstanceMaterial_setZWrite(swigCPtr, this, active);
  }

  public void setZFunc(UInstanceMaterial.ZFunc val) {
    nel3dJNI.UInstanceMaterial_setZFunc(swigCPtr, this, val.swigValue());
  }

  public float getAlphaTestThreshold() {
    return nel3dJNI.UInstanceMaterial_getAlphaTestThreshold(swigCPtr, this);
  }

  public void setAlphaTest(boolean active) {
    nel3dJNI.UInstanceMaterial_setAlphaTest(swigCPtr, this, active);
  }

  public boolean getBlend() {
    return nel3dJNI.UInstanceMaterial_getBlend(swigCPtr, this);
  }

  public UInstanceMaterial.TBlend getSrcBlend() {
    return UInstanceMaterial.TBlend.swigToEnum(nel3dJNI.UInstanceMaterial_getSrcBlend(swigCPtr, this));
  }

  public UInstanceMaterial.TBlend getDstBlend() {
    return UInstanceMaterial.TBlend.swigToEnum(nel3dJNI.UInstanceMaterial_getDstBlend(swigCPtr, this));
  }

  public void setEmissive(CRGBA emissive) {
    nel3dJNI.UInstanceMaterial_setEmissive__SWIG_0(swigCPtr, this, CRGBA.getCPtr(emissive), emissive);
  }

  public void setEmissive() {
    nel3dJNI.UInstanceMaterial_setEmissive__SWIG_1(swigCPtr, this);
  }

  public void setAmbient(CRGBA ambient) {
    nel3dJNI.UInstanceMaterial_setAmbient__SWIG_0(swigCPtr, this, CRGBA.getCPtr(ambient), ambient);
  }

  public void setAmbient() {
    nel3dJNI.UInstanceMaterial_setAmbient__SWIG_1(swigCPtr, this);
  }

  public void setDiffuse(CRGBA diffuse) {
    nel3dJNI.UInstanceMaterial_setDiffuse__SWIG_0(swigCPtr, this, CRGBA.getCPtr(diffuse), diffuse);
  }

  public void setDiffuse() {
    nel3dJNI.UInstanceMaterial_setDiffuse__SWIG_1(swigCPtr, this);
  }

  public void setOpacity(short opa) {
    nel3dJNI.UInstanceMaterial_setOpacity(swigCPtr, this, opa);
  }

  public void setSpecular(CRGBA specular) {
    nel3dJNI.UInstanceMaterial_setSpecular__SWIG_0(swigCPtr, this, CRGBA.getCPtr(specular), specular);
  }

  public void setSpecular() {
    nel3dJNI.UInstanceMaterial_setSpecular__SWIG_1(swigCPtr, this);
  }

  public void setShininess(float shininess) {
    nel3dJNI.UInstanceMaterial_setShininess(swigCPtr, this, shininess);
  }

  public CRGBA getEmissive() {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getEmissive(swigCPtr, this), true);
  }

  public CRGBA getAmbient() {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getAmbient(swigCPtr, this), true);
  }

  public CRGBA getDiffuse() {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getDiffuse(swigCPtr, this), true);
  }

  public short getOpacity() {
    return nel3dJNI.UInstanceMaterial_getOpacity(swigCPtr, this);
  }

  public CRGBA getSpecular() {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getSpecular(swigCPtr, this), true);
  }

  public float getShininess() {
    return nel3dJNI.UInstanceMaterial_getShininess(swigCPtr, this);
  }

  public void setColor(CRGBA rgba) {
    nel3dJNI.UInstanceMaterial_setColor(swigCPtr, this, CRGBA.getCPtr(rgba), rgba);
  }

  public CRGBA getColor() {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getColor(swigCPtr, this), true);
  }

  public void setConstantColor(long stage, CRGBA color) {
    nel3dJNI.UInstanceMaterial_setConstantColor(swigCPtr, this, stage, CRGBA.getCPtr(color), color);
  }

  public CRGBA getConstantColor(long stage) {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getConstantColor(swigCPtr, this, stage), true);
  }

  public void setUserColor(CRGBA userColor) {
    nel3dJNI.UInstanceMaterial_setUserColor(swigCPtr, this, CRGBA.getCPtr(userColor), userColor);
  }

  public CRGBA getUserColor() {
    return new CRGBA(nel3dJNI.UInstanceMaterial_getUserColor(swigCPtr, this), true);
  }

  public int getLastTextureStage() {
    return nel3dJNI.UInstanceMaterial_getLastTextureStage(swigCPtr, this);
  }

  public boolean isTextureFile(long stage) {
    return nel3dJNI.UInstanceMaterial_isTextureFile(swigCPtr, this, stage);
  }

  public String getTextureFileName(long stage) {
    return nel3dJNI.UInstanceMaterial_getTextureFileName(swigCPtr, this, stage);
  }

  public void emptyTexture(long stage) {
    nel3dJNI.UInstanceMaterial_emptyTexture__SWIG_0(swigCPtr, this, stage);
  }

  public void emptyTexture() {
    nel3dJNI.UInstanceMaterial_emptyTexture__SWIG_1(swigCPtr, this);
  }

  public void setTextureFileName(String fileName, long stage) {
    nel3dJNI.UInstanceMaterial_setTextureFileName__SWIG_0(swigCPtr, this, fileName, stage);
  }

  public void setTextureFileName(String fileName) {
    nel3dJNI.UInstanceMaterial_setTextureFileName__SWIG_1(swigCPtr, this, fileName);
  }

  public void setTextureMem(long stage, SWIGTYPE_p_unsigned_char data, long length, boolean _delete, boolean isFile, long width, long height, SWIGTYPE_p_NLMISC__CBitmap__TType texType) {
    nel3dJNI.UInstanceMaterial_setTextureMem__SWIG_0(swigCPtr, this, stage, SWIGTYPE_p_unsigned_char.getCPtr(data), length, _delete, isFile, width, height, SWIGTYPE_p_NLMISC__CBitmap__TType.getCPtr(texType));
  }

  public void setTextureMem(long stage, SWIGTYPE_p_unsigned_char data, long length, boolean _delete, boolean isFile, long width, long height) {
    nel3dJNI.UInstanceMaterial_setTextureMem__SWIG_1(swigCPtr, this, stage, SWIGTYPE_p_unsigned_char.getCPtr(data), length, _delete, isFile, width, height);
  }

  public void setTextureMem(long stage, SWIGTYPE_p_unsigned_char data, long length, boolean _delete, boolean isFile, long width) {
    nel3dJNI.UInstanceMaterial_setTextureMem__SWIG_2(swigCPtr, this, stage, SWIGTYPE_p_unsigned_char.getCPtr(data), length, _delete, isFile, width);
  }

  public void setTextureMem(long stage, SWIGTYPE_p_unsigned_char data, long length, boolean _delete, boolean isFile) {
    nel3dJNI.UInstanceMaterial_setTextureMem__SWIG_3(swigCPtr, this, stage, SWIGTYPE_p_unsigned_char.getCPtr(data), length, _delete, isFile);
  }

  public void setTextureMem(long stage, SWIGTYPE_p_unsigned_char data, long length, boolean _delete) {
    nel3dJNI.UInstanceMaterial_setTextureMem__SWIG_4(swigCPtr, this, stage, SWIGTYPE_p_unsigned_char.getCPtr(data), length, _delete);
  }

  public void setWrapS(long stage, UInstanceMaterial.TWrapMode mode) {
    nel3dJNI.UInstanceMaterial_setWrapS(swigCPtr, this, stage, mode.swigValue());
  }

  public void setWrapT(long stage, UInstanceMaterial.TWrapMode mode) {
    nel3dJNI.UInstanceMaterial_setWrapT(swigCPtr, this, stage, mode.swigValue());
  }

  public UInstanceMaterial.TWrapMode getWrapS(long stage) {
    return UInstanceMaterial.TWrapMode.swigToEnum(nel3dJNI.UInstanceMaterial_getWrapS(swigCPtr, this, stage));
  }

  public UInstanceMaterial.TWrapMode getWrapT(long stage) {
    return UInstanceMaterial.TWrapMode.swigToEnum(nel3dJNI.UInstanceMaterial_getWrapT(swigCPtr, this, stage));
  }

  public void enableUserTexMat(long stage, boolean enabled) {
    nel3dJNI.UInstanceMaterial_enableUserTexMat__SWIG_0(swigCPtr, this, stage, enabled);
  }

  public void enableUserTexMat(long stage) {
    nel3dJNI.UInstanceMaterial_enableUserTexMat__SWIG_1(swigCPtr, this, stage);
  }

  public boolean isUserTexMatEnabled(long stage) {
    return nel3dJNI.UInstanceMaterial_isUserTexMatEnabled(swigCPtr, this, stage);
  }

  public void setUserTexMat(long stage, SWIGTYPE_p_NLMISC__CMatrix m) {
    nel3dJNI.UInstanceMaterial_setUserTexMat(swigCPtr, this, stage, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(m));
  }

  public SWIGTYPE_p_NLMISC__CMatrix getUserTexMat(long stage) {
    return new SWIGTYPE_p_NLMISC__CMatrix(nel3dJNI.UInstanceMaterial_getUserTexMat(swigCPtr, this, stage), false);
  }

  public UInstanceMaterial() {
    this(nel3dJNI.new_UInstanceMaterial__SWIG_0(), true);
  }

  public UInstanceMaterial(CMeshBaseInstance mbi, CMaterial object, CAsyncTextureBlock asyncTextureBlock) {
    this(nel3dJNI.new_UInstanceMaterial__SWIG_1(CMeshBaseInstance.getCPtr(mbi), mbi, CMaterial.getCPtr(object), object, CAsyncTextureBlock.getCPtr(asyncTextureBlock), asyncTextureBlock), true);
  }

  public void attach(CMeshBaseInstance mbi, CMaterial object, CAsyncTextureBlock asyncTextureBlock) {
    nel3dJNI.UInstanceMaterial_attach(swigCPtr, this, CMeshBaseInstance.getCPtr(mbi), mbi, CMaterial.getCPtr(object), object, CAsyncTextureBlock.getCPtr(asyncTextureBlock), asyncTextureBlock);
  }

  public void detach() {
    nel3dJNI.UInstanceMaterial_detach(swigCPtr, this);
  }

  public boolean empty() {
    return nel3dJNI.UInstanceMaterial_empty(swigCPtr, this);
  }

  public CMaterial getObjectPtr() {
    long cPtr = nel3dJNI.UInstanceMaterial_getObjectPtr(swigCPtr, this);
    return (cPtr == 0) ? null : new CMaterial(cPtr, false);
  }

  public final static class ZFunc {
    public final static ZFunc always = new ZFunc("always", nel3dJNI.UInstanceMaterial_always_get());
    public final static ZFunc never = new ZFunc("never");
    public final static ZFunc equal = new ZFunc("equal");
    public final static ZFunc notequal = new ZFunc("notequal");
    public final static ZFunc less = new ZFunc("less");
    public final static ZFunc lessequal = new ZFunc("lessequal");
    public final static ZFunc greater = new ZFunc("greater");
    public final static ZFunc greaterequal = new ZFunc("greaterequal");
    public final static ZFunc zfuncCount = new ZFunc("zfuncCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static ZFunc swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + ZFunc.class + " with value " + swigValue);
    }

    private ZFunc(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private ZFunc(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private ZFunc(String swigName, ZFunc swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static ZFunc[] swigValues = { always, never, equal, notequal, less, lessequal, greater, greaterequal, zfuncCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TBlend {
    public final static TBlend one = new TBlend("one", nel3dJNI.UInstanceMaterial_one_get());
    public final static TBlend zero = new TBlend("zero");
    public final static TBlend srcalpha = new TBlend("srcalpha");
    public final static TBlend invsrcalpha = new TBlend("invsrcalpha");
    public final static TBlend srccolor = new TBlend("srccolor");
    public final static TBlend invsrccolor = new TBlend("invsrccolor");
    public final static TBlend blendCount = new TBlend("blendCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TBlend swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TBlend.class + " with value " + swigValue);
    }

    private TBlend(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TBlend(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TBlend(String swigName, TBlend swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TBlend[] swigValues = { one, zero, srcalpha, invsrcalpha, srccolor, invsrccolor, blendCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TWrapMode {
    public final static TWrapMode Repeat = new TWrapMode("Repeat", nel3dJNI.UInstanceMaterial_Repeat_get());
    public final static TWrapMode Clamp = new TWrapMode("Clamp");
    public final static TWrapMode WrapModeCount = new TWrapMode("WrapModeCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TWrapMode swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TWrapMode.class + " with value " + swigValue);
    }

    private TWrapMode(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TWrapMode(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TWrapMode(String swigName, TWrapMode swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TWrapMode[] swigValues = { Repeat, Clamp, WrapModeCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
